package com.gxy.learn.upload.web;

import com.gxy.learn.upload.service.UploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;
import java.util.Map;

/**
 * Description:
 * author: Gaoxueyong
 * Create at: 2023/2/8 16:12
 */


@RestController
public class UploadController {
    @Autowired
    private UploadService uploadService;

    @RequestMapping(value = "/upload", method = RequestMethod.POST)
    public Map<String, String> upload(MultipartFile muFile, String channel, String env, String version) throws Exception {

        Map<String, String> res = new HashMap<>();
        res.put("msg", uploadService.upload(muFile, channel, env, version));
        return res;
    }
}

